<?php

namespace App\Http\Controllers\Admin;

use App\Models\OrderGoods;
use App\Models\Picture;
use App\Models\Shop;
use App\Models\WaterBillOrder;


/**
 * 订单管理控制器
 */
class WaterBillOrderController extends BaseController
{

    public function __construct(WaterBillOrder $waterBillOrder, Shop $shop, Picture $picture )
    {
        parent::__construct();
        $this->waterBillOrder = $waterBillOrder;
        $this->shop = $shop;
        $this->picture = $picture;
    }


    public function getIndex()
    {
        $shopList = $this->shop->_getList(['admin_id' => is_login()])->toArray();
        $rows = $this->waterBillOrder->getOwnOrderList(request('shop_id'));
        if (request('shop_id')) {
            foreach ($shopList as $v) {
                if ($v['id'] == request('shop_id')) {
                    $curentShop = $v;
                }
            }
        }
        $ext = $this->picture->config['saveExt'];
        $mini = 60;
        if ($this->picture->config['cut_Mini_Size']) {
            $miniArr = explode(',', $this->picture->config['cut_Mini_Size']);
            $mini = $miniArr[0];
        }
        $listType = $this->waterBillOrder->listType;
        return view('admin.bill_order.index', compact('rows', 'shopList', 'curentShop', 'ext', 'mini','listType'));
    }

}
